package com.vegetable.modules.controller.sys;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vegetable.common.utils.PageUtils;
import com.vegetable.common.utils.R;
import com.vegetable.modules.entity.sys.po.EntityChangeLogQueryPO;
import com.vegetable.modules.service.sys.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;


/**
 * 系统日志
 *
 * @author Mark sunlightcs@gmail.com
 */
@Controller
@RequestMapping("/sys/log")
@Api(value = "登录相关", tags = "登录相关")
public class SysLogController {
	@Autowired
	private SysLogService sysLogService;
	
	/**
	 * 列表
	 */
	@ResponseBody
	@GetMapping("/list")
	@ApiOperation(value = "条件查询系统日志", notes = "条件查询系统日志")
	public R list(@RequestParam Map<String, Object> params){
		PageUtils page = sysLogService.queryPage(params);
		return R.data(page);
	}
	
	/**
	 * 实体变更日志列表
	 */
	@ResponseBody
	@GetMapping("/entityChangeList")
	@ApiOperation(value = "条件查询实体变更日志", notes = "条件查询实体变更日志")
	public R entityChangeList(EntityChangeLogQueryPO po){
		IPage page = sysLogService.queryEntityChangeLogs(po);
		return R.data(page);
	}
	
}